<template>
  <div>

    <f-table ref="table" size="small" rowKey="orderId"  :showSetting="true" setting-key='ordertask2'  :tableColumns="columns"   :scroll="{x:true}" :multiple="false" :operator="operator" :params="queryParam" :api="api.busOrder" handler="nqOrderListHandler">
         <span slot="supplierBondType" slot-scope="text, record, index">
            <a-tag color="#2db7f5" v-if="text==0">不垫付</a-tag>
            <a-tag color="purple" v-if="text==1">底价</a-tag>
            <a-tag color="purple" v-if="text==2">底价+税金</a-tag>
            <a-tag color="purple" v-if="text==3">税金</a-tag>
            <a-tag color="purple" v-if="text==6">底价/2+税金</a-tag>
            <a-tag color="purple" v-if="text==5">全额垫付</a-tag>
            <a-tag color="purple" v-if="text==8">销售金额*费率</a-tag>
        </span>
      <span slot="customBondType" slot-scope="text, record, index">
           <a-tag color="#2db7f5" v-if="text==0">全款</a-tag>
            <a-tag color="purple" v-if="text==1">底价</a-tag>
            <a-tag color="purple" v-if="text==2">底价+税金</a-tag>
            <a-tag color="purple" v-if="text==6">底价/2+税金</a-tag>
            <a-tag color="purple" v-if="text==3">税金</a-tag>
            <a-tag color="purple" v-if="text==5">全额资信</a-tag>
            <a-tag color="purple" v-if="text==7">预付款</a-tag>
        </span>
      <span slot="action" slot-scope="text, record">
          <template>
            <a @click="$refs.orderInfoDrawer.showDrawer(record)">查看</a>
             <a-divider type="vertical"/>
             <a href="javascript:;" @click="processImg(record)">审批进度</a>
          </template>
        </span>
    </f-table>
    <process-image ref="processImg" v-if="processImageVisible" :visible.sync="processImageVisible" :processInstanceId="processInstanceId"></process-image>
    <order-info-drawer ref="orderInfoDrawer"></order-info-drawer>
  </div>
</template>
<script>

  import api from './js/api'
  import ProcessImage from '../process/process_image'
  import OrderInfoDrawer from '../../business/order/order_info_drawer'
  export default {
    name: 'TodoYes',
    components: {
      ProcessImage,
      OrderInfoDrawer
    },
    data() {
      let me = this
      //操作按钮
      let operator = []

      return {
        api: Object.assign(api, this.api),
        //列表初始化查询参数
        queryParam: {
          processFinished:false,
          activeKey:3
        },
        processInstanceId: '',
        processImageVisible: false,
        // 表头
        columns: [
          {
            title: '操作',
            align: 'center',
            scopedSlots: { customRender: 'action' }
          },
          {
            title: '单号',
            align: 'center',
            dataIndex: 'orderNo'
          },
          {
            title: '发货日期',
            align: 'center',
            dataIndex: 'sendDate'
          },

          {
            title: '部门',
            align: 'center',
            dataIndex: 'deptName'
          },
          {
            title: '负责人',
            align: 'center',
            dataIndex: 'saleManName'
          },
          {
            title: '供货方',
            align: 'center',
            dataIndex: 'supplierName'
          },
          {
            title: '供方资信',
            align: 'center',
            width: '100px',
            dataIndex: 'supplierBondType',
            scopedSlots: { customRender: 'supplierBondType' }
          },
          {
            title: '购货方',
            align: 'center',
            dataIndex: 'customName'
          },
          {
            title: '购方资信',
            align: 'center',
            width: '100px',
            dataIndex: 'customBondType',
            scopedSlots: { customRender: 'customBondType' }
          },
          {
            title: '收款金额',
            align: 'center',
            dataIndex: 'takeAmount'
          },
          {
            title: '收款日期',
            align: 'center',
            dataIndex: 'takeDate'
          },
          {
            title: '制单人',
            align: 'center',
            dataIndex: 'nickName'
          },
          {
            title: '当前审批人',
            align: 'center',
            dataIndex: 'assignee'
          },
          {
            title: '创建日期',
            align: 'center',
            dataIndex: 'createTime'
          }

        ],
        operator: operator
      }
    },
    created() {
    },
    methods: {
      onLoad() {
        this.$refs.table.refresh()
      },
      processImg(task) {
        this.processInstanceId = task.processInstanceId
        this.processImageVisible = true
      },
      /**
       * 查询事件
       * @param searchParams
       */
      searchTable(searchParams) {
        this.queryParam = Object.assign(this.queryParam, searchParams)
        this.$refs.table.refresh(true, searchParams)
      }
    }
  }
</script>
